package ClassWork.Work_01;

import java.util.Scanner;

public class NarcissisticNumber {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter a number: ");
        int num = sc.nextInt();
        if(num > 999){
            System.out.println("输入有误");
        }else{
            boolean flag = flower(num);
            if(flag){
                System.out.println("这是水仙花数");
            }else{
                System.out.println("这不是水仙花数");
            }
        }
    }
    public static boolean flower(int n) {
        int x = n / 100;
        int y = (n % 100) / 10;
        int z = n % 10;
        int m = (int)(Math.pow(x,3) + Math.pow(y,3) + Math.pow(z,3));
        return m == n;
    }
}
